package com.tfswufe.xxm.controller;

import com.tfswufe.xxm.service.EventPublisherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/user")
public class RegisterController {
    @Autowired
    private EventPublisherService eventPublisher;

    @PostMapping("/register")
    public ResponseEntity<String> registerUser(
            @RequestParam String username,
            @RequestParam String email ){
            eventPublisher.publishUserRegistered(username, email);
            return ResponseEntity.ok("用户注册成功");
    }

}
